package ast.io;

import java.io.*;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;

import org.eclipse.jdt.core.dom.ASTNode;

import astStatData.ElementMap;

public class statDataWriter {

	public void write(ElementMap elemap, File file) {
		try {
			FileWriter w = new FileWriter(file);
			write(elemap.getCUs(), w, 0);
			write(elemap.getNodeMap(), w, 0);
			w.close();			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	private void write(HashSet<ASTNode> cuSet, Writer w, int indent) throws IOException {	
		w.write("<CompileUnit name=\"" + cuSet.isEmpty() + "\">\n");
		space(w);
		w.write(cuSet.toString()+"\n");
		space(w);
		w.write("</CompileUnit>\n");
	}
	
	private void write(HashMap<String, ASTNode> nodeMap, Writer w, int indent) throws IOException {

	}
	
	private void space(Writer w) throws IOException {
		w.write(" ");
	}
}